package com.yunyun400.vosk.util;

public enum Language {
    // 语言代码作为 key，模型文件夹名称作为 value
    CN("cn", "models/vosk-model-small-cn-0.22"),
    TH("th", "models/vosk-model-small-th-0.15"),
    EN("en", "models/vosk-model-small-en-us-0.15");

    private final String code;
    private final String modelFolderName;

    Language(String code, String modelFolderName) {
        this.code = code;
        this.modelFolderName = modelFolderName;
    }

    public String getCode() {
        return code;
    }

    public String getModelFolderName() {
        return modelFolderName;
    }

    // 提供一个静态方法，根据语言代码字符串获取枚举实例
    public static Language fromCode(String code) {
        for (Language lang : values()) {
            if (lang.getCode().equalsIgnoreCase(code)) {
                return lang;
            }
        }
        return null; // 如果找不到匹配的语言
    }
}
